#include "SList.h"

void TestSList1()
{
	SLTNode* s = NULL;
	SLTPushBack(&s, 1);
	SLTPushBack(&s, 2);
	SLTPushBack(&s, 3);
	SLTPushBack(&s, 4);
	SLTPushBack(&s, 5);
	SLTPushBack(&s, 6);
	SLTPushBack(&s, 7);
	SLTPrint(s);
}

void TestSList2()
{
	SLTNode* s = NULL;
	SLTPushFront(&s, 1);
	SLTPushFront(&s, 2);
	SLTPushFront(&s, 3);
	SLTPushFront(&s, 4);
	SLTPushFront(&s, 5);
	SLTPushFront(&s, 6);
	SLTPushFront(&s, 7);
	SLTPrint(s);

	SLTPopBack(&s);
	SLTPopBack(&s);
	SLTPrint(s);

	SLTPopFront(&s);
	SLTPopFront(&s);
	SLTPrint(s);

}

void TestSList3()
{
	SLTNode* s = NULL;
	SLTPushFront(&s, 1);
	SLTPushFront(&s, 2);
	SLTPushFront(&s, 3);
	SLTPushFront(&s, 4);
	SLTPushFront(&s, 5);
	SLTPushFront(&s, 6);
	SLTPushFront(&s, 7);
	SLTPrint(s);

	SLTNode* num1 = SLTFind(s, 4);
	SLTInsertFront(&s, num1, 20);
	SLTPrint(s);

	SLTNode* num2 = SLTFind(s, 3);
	SLTEraseFront(&s, num2);
	SLTPrint(s);

	SLTNode* num3 = SLTFind(s, 3);
	SLTInsertAfter(num3, 66);
	SLTPrint(s);

	SLTNode* num4 = SLTFind(s, 5);
	SLTEraseAfter(num4);
	SLTPrint(s);

	SLTNode* num5 = SLTFind(s, 7);
	SLTErase(&s, num5);
	SLTPrint(s);

	SLTNode* num6 = SLTFind(s, 5);
	SLTErase(&s, num6);
	SLTPrint(s);
}
int main()
{
	TestSList3();

	return 0;
}